<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <button>innerText</button><br>
    <button>innerHTML</button>
    <button>nodeValue</button>
    <script>
        var oDiv = document.querySelector('div');
        var btn1 = document.querySelectorAll('button')[0];
        var btn2 = document.querySelectorAll('button')[1];
        var btn3 = document.querySelectorAll('button')[2];

        btn1.onclick = function(){
            // 向节点中添加文本内容
            oDiv.innerText = '<a href="http://baidu.com">百度</a>'; 
        }

        btn2.onclick = function(){
            // 向节点中写入内容，该内容可以被解析成html标签
            oDiv.innerHTML = '<a href="http://baidu.com">百度</a>'; 
        }

        btn3.onclick = function(){
            // oDiv.nodeValue = '<a href="http://baidu.com">百度</a>'; 
        }
    </script>
</body>
</html>